<extend name="Public/base"/>

<block name="body">

<script>
    function center_toggle(name) {
        var show = $('#' + name + '_panel').css('display');
        $('.center_panel').hide();
        $('.center_arrow_right').show();
        $('.center_arrow_bottom').hide()
        if (show == 'none') {
            $('#' + name + '_panel').show();
            $('#' + name + '_toggle_right').hide();
            $('#' + name + '_toggle_bottom').show()
        } else {
            $('#' + name + '_toggle_right').show();
            $('#' + name + '_toggle_bottom').hide()
        }

    }
</script>
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
<div id="center">
<div id="center_base">
<div>


<div id="center_account">
    <div class="row">
        <div class="col-xs-12">
            <ul class="nav nav-secondary">
                <li class="active"><a href="#base" data-toggle="tab">基本资料</a></li>
                <volist name="profile_group_list" id="vl">
                    <li>
                        <a href="#expand_tab_{$vl.id}" data-toggle="tab">{$vl.profile_name}</a>
                    </li>
                </volist>
            </ul>

        </div>
    </div>
    <div class="tab-content">
        <div class="tab-pane active" id="base">
            <div class="with-padding" style="padding: 20px">
                <div class="row">
                    <div class="col-xs-8 center_info form-horizontal">
                        <php>if(check_reg_type('username')){</php>
                        <div class="form-group">
                            <label for="aUsername" class="col-xs-2 control-label" style="font-weight:bold">{:L('_USERNAME_')}</label>

                            <div class="col-xs-10">
                                <php>if($accountInfo['username']){</php>
                                <span class="lh32">{$accountInfo['username']}</span>
                                <php>}else{</php>
                                <input type="text" class="form-control pull-left" id="aUsername" value=""
                                       placeholder="{:L('_USER_NAME_NOT_SET_')}{:L('_WAVE_')}">
                                <a class="pull-left lh32 saveUsername" style="margin-left: 10px">{:L('_SETTINGS_')}</a>
                                <script>
                                    $(function () {
                                        $('.saveUsername').click(function () {
                                            var username = $(this).prev().val();
                                            if (!username) {
                                                toast.error("{:L('_USERNAME_NOT_EMPTY_')}{:L('_EXCLAMATION_')}");
                                                return false;
                                            }
                                            if (confirm("{:L('_USERNAME_SET_ONCE_')}{:L('_QUESTION_')}")) {
                                                $.post("{:U('ucenter/config/saveUsername')}", {username: username}, function (res) {
                                                    handleAjax(res);
                                                })
                                            }
                                        })
                                    })
                                </script>
                                <php>}</php>
                            </div>
                            
                        </div>
                        
                        

                        <php>}</php>

                        <php>if(check_reg_type('email')){</php>
                        <div class="form-group">
                            <label for="aEmail" class="col-xs-2 control-label">{:L('_EMAIL_')}</label>

                            <div class="col-xs-10">

                                {$accountInfo.email|default=L('_SET_NOT_')}
                                <a class=" lh32 " style="margin-left: 10px"
                                   data-remote="{:U('ucenter/config/changeaccount',array('tag'=>'email'))}"
                                   data-toggle="modal">{:L('_EMAIL_MODIFY_')}</a>
                            </div>
                        </div>
                        <php>}</php>
                        
                        

                        <php>if(check_reg_type('mobile')){</php>

                        <div class="form-group">
                            <label for="aMobile" class="col-xs-2 control-label" style="font-weight:bold">{:L('_PHONE_')}</label>

                            <div class="col-xs-10" >
                                {$accountInfo.mobile|default=L('_SET_NOT_')}

                                <a class=" lh32 " style="margin-left: 10px"
                                   data-remote="{:U('ucenter/config/changeaccount',array('tag'=>'mobile'))}"
                                   data-toggle="modal">{:L('_PHONE_MODIFY_')}</a>
                            </div>
                        </div>
                        <php>}</php>
                    </div>
                </div>
                <div class="row">
                    <div class="col-xs-8">
                        <form class="form-horizontal center_info ajax-form" role="form"
                              action="{:U('Ucenter/Config/index')}" method="post">
                            <div class="form-group">
                                <label for="nickname" class="col-xs-2 control-label" style="font-weight:bold">真实姓名</label>

                                <div class="col-xs-10">
                                    <input style="width:150px" type="text" class="form-control" id="nickname" name="nickname"
                                           value="{$user.nickname|op_t}"
                                           placeholder="{:L('_NICKNAME_')}">
                                </div>
                            </div>
                            

                            <div class="form-group">
                                <label class="col-xs-2 control-label" style="font-weight:bold">{:L('_SEX_')}</label>

                                <div class="col-xs-10">
                                    <label class="radio-inline">
                                        <input name="sex" type="radio" value="1"
                                        <eq name="user.sex" value="1"> checked</eq>
                                       >{:L('_MAN_')}
                                    </label>
                                    <label class="radio-inline">
                                        <input name="sex" type="radio" value="2"
                                        <eq name="user.sex" value="2"> checked</eq>
                                       >{:L('_WOMAN_')}
                                    </label>
                                    <label class="radio-inline">
                                        <input name="sex" type="radio" value="0"
                                        <eq name="user.sex" value="0"> checked</eq>
                                       >{:L('_SECRECY_')}
                                    </label>
                                </div>
                            </div>
                           <!--  
                            <div class="form-group">
                                <label class="col-xs-2 control-label" style="font-weight:bold">身份</label>

                                <div class="col-xs-10">
                                    <label class="radio-inline">
                                        <input name="shenfen" type="radio" value="1"
                                        <eq name="user.shenfen" value="1"> checked</eq>
                                       >技术持有者
                                    </label>
                                    <label class="radio-inline">
                                        <input name="shenfen" type="radio" value="2"
                                        <eq name="user.shenfen" value="2"> checked</eq>
                                       >技术需求者
                                    </label>
                                </div>
                            </div> -->

                           <div class="form-group">
                                <label for="moblie" class="col-xs-2 control-label" style="font-weight:bold">联系方式</label>

                                <div class="col-xs-10">
                                    <input  style="width:150px" type="text" class="form-control" id="moblie" name="moblie"
                                           value="{$user.moblie|op_t}"
                                           placeholder="{:L('_MOBILE_')}">
                                </div>
                            </div>

                            <div class="form-group position">
                                <label for="email" class="col-xs-2 control-label" style="font-weight:bold">{:L('_PLACE_')}</label>

                                <div class="col-xs-10" style="width:100px;">
                                    {:hook('J_China_City',array('province'=>$user['pos_province'],'city'=>$user['pos_city'],'district'=>$user['pos_district'],'community'=>$user['pos_community']))}
                                </div>
                            </div>
                            
                                                                                  
                           <div class="form-group">
                                <label for="unit" class="col-xs-2 control-label" style="font-weight:bold">{:L('_UNIT_')}</label>

                                <div class="col-xs-10">
                                    <input style="width:150px" type="text" class="form-control" id="unit" name="unit"
                                           value="{$user.unit|op_t}"
                                           placeholder="{:L('_UNIT_')}">
                                </div>
                            </div>
                                                        
                            
			  
			  
			  <div class="form-item cf" style="margin-left:80px;">
			     <label class="item-label">上传图片<span class="check-tips"></span></label>
			     	<div class="controls">
			            <div id="upload_single_image_" style="padding-bottom: 5px;">选择图片</div>
			            <input class="attach" type="hidden" name="" value="{$data.pic}"/>
			            <div class="upload-img-box">
			                <div class="upload-pre-item popup-gallery">
							<notempty name="data.pic">
								<div class="each">
								<a href="{$data.pic}" title="点击查看大图"><img src="{$data.pic}"></a>
								<div class="text-center opacity del_btn" ></div>
								<div onclick="admin_image.removeImage($(this),'+data.id+')"  class="text-center del_btn">删除</div>
								</div>
			                </notempty>           
			                </div>
			            </div>
			        </div>        
               </div> 
             
             </br>
			  
          <script>
            $(function () {
                var uploader_= WebUploader.create({
                    // 选完文件后，是否自动上传。
                    auto: true,
                    // swf文件路径
                    swf: 'Uploader.swf',
                    // 文件接收服务端。
                    server: "{:U('File/uploadPicture',array('session_id'=>session_id()))}",
                    // 选择文件的按钮。可选。
                    // 内部根据当前运行是创建，可能是input元素，也可能是flash.
                    pick: '#upload_single_image_',
                    // 只允许选择图片文件
                    accept: {
                        title: 'Images',
                        extensions: 'gif,jpg,jpeg,bmp,png',
                        mimeTypes: 'image/*'
                    }
                });
                uploader_.on('fileQueued', function (file) {
                    uploader_.upload();
                });
                /*上传成功**/
                uploader_.on('uploadSuccess', function (file, data) {
                    if (data.status) {
                        $("[name='']").val(data.id);
                        $("[name='']").parent().find('.upload-pre-item').html(
                                '<input type="hidden" name="pic" value="'+ data.path+'"/><div class="each"><a href="'+ data.path+'" title="点击查看大图"><img src="'+ data.path+'"></a><div class="text-center opacity del_btn" ></div>' +
                                        '<div onclick="admin_image.removeImage($(this),'+data.id+')"  class="text-center del_btn">删除</div></div>'
                        );
                        uploader_.reset();
                    } else {
                        updateAlert(data.info);
                        setTimeout(function () {
                            $('#top-alert').find('button').click();
                            $(that).removeClass('disabled').prop('disabled', false);
                        }, 1500);
                    }
                });
            })
        </script>               
                            <div class="form-group">
                                <label for="signature" class="col-xs-2 control-label" style="font-weight:bold">{:L('_SIGNATURE_')}</label>

                                <div class="col-xs-10">
                                    <textarea style="width:250px" id="signature" name="signature" class="form-control"
                                              style="width: 100%; height: 6em;resize: none">{$user.signature|htmlspecialchars}</textarea>
                                </div>
                            </div>
                              
                            <div class="form-group">
                                <div class="col-sm-offset-2 col-xs-10">
                                    <a id="submit-btn" class="btn btn-primary">{:L('_SAVE_')}</a>
                                </div>
                            </div>
                        </form>
                    </div>

                </div>

            </div>
        </div>



            <volist name="profile_group_list" id="vo">

                <div class="tab-pane" id="expand_tab_{$vo.id}">
                    <form action="{:U('Config/edit_expandinfo')}" method="post" class="ajax-form" enctype="multipart/form-data">
                    <div class="with-padding">
                        <div class="row">
                            <div class="col-xs-8">
                                <input type="hidden" name="profile_group_id" value="{$vo.id}">
                                <div>
                                    <volist name="vo.fields" id="vl">
                                        <dl>
                                            {:W('InputRender/inputRender',array($vl,'personal'))}
                                        </dl>
                                    </volist>
                                </div>
                                <!-- <if condition="count($vo['fields']) neq 0">
                                    <input type="submit" value="{:L('_SAVE_')}" id="submit_btn"
                                           class="btn btn-primary expandinfo-sumbit">
                                    <else/> -->
                                    <span class="expandinfo-noticeinfo">{:L('_MESSAGE_EXPAND_NONE_')}{:L('_EXCLAMATION_')}</span>
                                </if>
                            </div>
                        </div>
                    </div>
                </form>
                </div>

            </volist>

    </div>


</div>
</div>


</div>
</div>


</div>

</block>

<script type="text/javascript" src="__JS__/expandinfo-form.js"></script>
<block name="script">
<script type="text/javascript">
$('#submit-btn').click(function(){
	var msg = new $.zui.Messager('保存成功！', {type:'success',placement: 'bottom'});
    msg.show();
});
    $('#type').click(function(){
        $(this).change(function(){
            var objectModel = {};
            var   value = $(this).val();
           var   type = $(this).attr('id');
          // var   lable = $(this).attr('id');
            objectModel[type] =value;
            
           // objectModel[lable] =value;
            $.ajax({
                cache:false,
                type:"POST",
                url:'{:U('lable')}',
                dataType:"json",
                data:objectModel,
                timeout:30000,
                error:function(){
                    alert(site.web+"lable");
                },
                success:function(data){
                    $("#lables").empty();
                    var count = data.length;
                    var i = 0;
                    var b="";
                       for(i=0;i<count;i++){
                           b+="<option value='"+data[i].id+"'>"+data[i].name+"</option>";
                       }
                    $("#lables").append(b);
                }
            });
           });
    });
    
</script>



</block>
